//Get rid of the sprintf warning outdate
#pragma warning( disable : 4996 )

WORD mouseX;
WORD mouseY;

LPD3DXFONT m_font;
LPDIRECT3DDEVICE9       pd3dDevice;	// the direct3d device

//HUD
void DisplayText(LPCSTR text, WORD number, int team, int xPos, int yPos);


/*********************************************************************************
	(LPCSTR text, = Like a String "Hello World"
	int number,   = Input a number if displaying one, NULL if not. Can't do both.
	int team,	  = Changes color of text 0: Black, 1: Alliance, 2: Horde, 3: Green
										  4: White
	int xPos,	  = X Coord where displaying
	int yPos)	  = Y Coord where displaying
**********************************************************************************/
void DisplayText(LPCSTR text, WORD number, int color, int xPos, int yPos)
{
	D3DCOLOR fontColor;

	  if(color == 1)
			fontColor = D3DCOLOR_ARGB(255,0,0,255);   //Alliance- BLUE
	  else if(color == 2)
			fontColor = D3DCOLOR_ARGB(255,255,0,0);  //Horde- Red
	  else if(color == 3)
			fontColor = D3DCOLOR_ARGB(255,0,255,0);  //GREEN
	  else if(color == 4)
			fontColor = D3DCOLOR_ARGB(255,255,255,255);  //GREEN
	  else
	  {
			// Create a color for Monsters - in this case black
			fontColor = D3DCOLOR_ARGB(255,0,0,0); 
	  }

      // Create a rectangle to indicate where on the screen it should be drawn
      RECT rct;
      rct.left=xPos;
      rct.right= rct.left + 120;
      rct.top=yPos;
      rct.bottom=rct.top+20;

	  if(number != NULL)
	  {
		 char outstring[50];
		 sprintf(outstring, "%d" , number);
		 m_font->DrawText(NULL, outstring, -1, &rct, DT_NOCLIP, fontColor); 
	  }
	  else
	  {
		// Draw some text
		m_font->DrawText(NULL, text , -1, &rct, DT_NOCLIP, fontColor );
	  }
}


void SetHudCamera(float WindowWidth, float WindowHeight)
{
	D3DXMATRIX Ortho2D;
	D3DXMATRIX Identity;

	D3DXMatrixOrthoLH(&Ortho2D, WindowWidth, WindowHeight, 0.0f, 1.0f);
	D3DXMatrixIdentity(&Identity);

	pd3dDevice->SetTransform(D3DTS_PROJECTION, &Ortho2D);
	pd3dDevice->SetTransform(D3DTS_WORLD, &Identity);
	pd3dDevice->SetTransform(D3DTS_VIEW, &Identity);
}


//Couldnt get graphics yet, prof working on it and will email it to us.
//Also working on it. -TJD
void drawHud()
{
	//Name/Health
	DisplayText("Horde: Garg ", NULL, 2, 60, 440);
	//DisplayText("Alliance: Banis ", NULL, 1, 60, 440);
	DisplayText("Health:", NULL, 0, 60 , 460);
	DisplayText(     NULL, 100 , 1, 120, 460);

	//Attack/Defense
	DisplayText(" Attack =", NULL, 0, 180, 440);
	DisplayText(	  NULL, 4	, 1, 255, 440);
	DisplayText("Defense =", NULL, 0, 173, 460);
	DisplayText(	  NULL, 5	, 1, 255, 460);

	//Magic/Resist
	DisplayText("  Magic =", NULL, 0, 280, 440);
	DisplayText(	  NULL, 6	, 1,  355, 440);
	DisplayText(" Resist =", NULL, 0, 280, 460);
	DisplayText(	  NULL, 3	, 1,  355, 460);

	//Attack/Magic Button
	DisplayText("1) Attack", NULL, 0, 400, 440);
	DisplayText("2) Magic ", NULL, 0, 400, 460);


	//TEST X,Y POSTION
	DisplayText("Test X:", NULL, 0, 10, 10);
	DisplayText(     NULL, mouseX, 1, 70, 10);
	DisplayText("Test Y:", NULL, 0, 10, 30);
	DisplayText(     NULL, mouseY, 1, 70, 30);
}
